<!doctype html>
<html lang="zh-hans" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>博客系统 | 写博客</title>
    <link rel="stylesheet" href="/css/common.css">
    <link rel="stylesheet" href="/css/edit.css">
    <link rel="stylesheet" href="/editor.md/css/editormd.min.css">
</head>
<body>
    <div class="nav">
        <!-- 头部导航 navigator -->
        <img src="/img/logo.jpeg" alt="logo 图">
        <span class="title" th:text="${user.nickname} + '的博客'">徐旺的博客</span>
        <!-- 无意义的，为了撑开布局空间 -->
        <span class="spacer"></span>
        <a href="/register.html">注册</a>
        <a href="/">主页</a>
        <a href="/edit.html">写博客</a>
        <!-- 注销：删除用户的登录状态，需要动态操作，暂时不管 -->
        <a href="/logout">注销</a>
    </div>

    <div class="blog-edit-container">
        <!-- 临时放在 form 表单中，直接跳转到文章正文页，以后学了动态会修改 -->
        <form action="/save-article" method="post">
            <div class="title">
                <input type="text" placeholder="请填写文章标题" id="title" name="title">
                <button id="submit">发布文章</button>
            </div>
            <div id="editor">
                <textarea name="content" style="display: none;"></textarea>
            </div>
        </form>
    </div>

    <script src="/js/jquery.min.js"></script>
    <script src="/editor.md/lib/marked.min.js"></script>
    <script src="/editor.md/lib/prettify.min.js"></script>
    <script src="/editor.md/editormd.js"></script>
    <script>
        editormd('editor', {
            width: '100%',
            height: 'calc(100% - 50px)',
            markdown: '# 请使用 markdown 格式写文章正文',
            path: '/editor.md/lib/',
            saveHTMLToTextarea: true
        });
    </script>
</body>
</html>